<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>领导审核页面</title>
    <link rel="stylesheet" href="../../res/layui/css/layui.css" media="all">
    <script type="text/javascript" src="../../res/js/Tools.js"></script>
    <script src="../../res/js/jquery-3.4.1.min.js" type="text/javascript"
            charset="utf-8"></script>
    <script src="../../js/login_common.js" charset="utf-8"></script>
    <script src="../../res/layui/layui.js" charset="utf-8"></script>
    <script>
        $.ajaxSetup({
            async : false
        });
        $(function(){
            var ide = getQueryString("id");
            $("#saId").val(ide);
        })

    </script>
</head>
<body>
<form class="layui-form" action="" id="formDId" lay-filter="example" method="post" enctype="multipart/form-data">
    <input type="hidden" id="saId" name="saId">
    <input type="hidden" id="yesOrno" name="yesOrno">
<div class="layui-form-item">
    <label class="layui-form-label">审核意见</label>
    <div class="layui-input-block" style="margin-top: 10px;margin-right: 100px;">
        <textarea placeholder="请输入审核意见" required lay-verify="required"
                  class="layui-textarea" name="auExp" id="auExp"></textarea>
    </div>
</div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-primary" id="button" lay-submit lay-filter="formDemo">审核通过</button>
            <button class="layui-btn layui-btn-danger" id="buttonone" lay-submit lay-filter="formDemoNo">审核不通过</button>
        </div>
    </div>
</form>
<script>
    var form=null;
    layui.use('form', function(){
        form = layui.form;

        //同意提交
        form.on('submit(formDemo)', function(data){
            //默认传20到前台代表同意
            $("#yesOrno").val(20);
            var formData = new FormData(document.getElementById("formDId"));
            var url="../../../RecoveryAtsSchemeController/auditUpdate";
            $("#button").attr("disabled","disabled");
            $.ajax({
                url:url,
                type:"post",
                data:formData,
                processData:false,
                contentType:false,
                dataType:"json",
                success:function(obj){
                    if(obj.num==1){
                        layer.msg(obj.msg,{
                            icon:6,
                            time:1000 //1秒关闭(如果不配置默认三秒)
                        },function(){
                            //关闭当前层
                            //当你在iframe页面关闭自身时
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                            //刷新父页面
                            //parent.location.reload();
                        });
                        return false ;
                    }
                },
                error:function(e){
                    layer.msg("错误！！");
                }
            });
            return false;
        });
        //监听提交
        form.on('submit(formDemoNo)', function(data){
            //默认传21到前台代表不同意
            $("#yesOrno").val(21);
            var formData = new FormData(document.getElementById("formDId"));
            var url="../../../RecoveryAtsSchemeController/auditUpdate";
            $("#buttonone").attr("disabled","disabled");
            $.ajax({
                url:url,
                type:"post",
                data:formData,
                processData:false,
                contentType:false,
                dataType:"json",
                success:function(obj){
                    if(obj.num==1){
                        layer.msg(obj.msg,{
                            icon:6,
                            time:1000 //1秒关闭(如果不配置默认三秒)
                        },function(){
                            //关闭当前层
                            //当你在iframe页面关闭自身时
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                            //刷新父页面
                            //parent.location.reload();
                        });
                        return false ;
                    }
                },
                error:function(e){
                    layer.msg("错误！！");
                }
            });
            return false;
        });
        var ide = getQueryString("id");



    });

</script>
</body>
</html>